<extend name="public@base5"/>
<block name="main">
    <div class="wrap">
        <ul class="nav nav-tabs">
            <li class="nav-item">
                <a class="nav-link" href="{:url('User/userInfo')}">{:lang('ADMIN_USER_USERINFO')}</a>
            </li>
            <li class="nav-item">
                <a class="nav-link active" href="{:url('User/emailSetting')}">{:lang('ADMIN_USER_EMAILSETTING')}</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="{:url('Setting/password')}">{:lang('ADMIN_SETTING_PASSWORD')}</a>
            </li>
        </ul>
        <form method="PUT" class="js-ajax-form margin-top-20" action="admin/my/email/setting">
            <div class="row mb-3">
                <label for="input-from_name" class="col-sm-2 col-form-label text-sm-end">
                    <span class="form-required">*</span>
                    {:lang('SENDER_NAME')}
                </label>
                <div class="col-md-8 col-sm-10">
                    <input type="text" class="form-control" id="input-from_name" name="from_name"
                           value="{$from_name|default=''}">
                </div>
            </div>
            <div class="row mb-3">
                <label for="input-from" class="col-sm-2 col-form-label text-sm-end">
                    <span class="form-required">*</span>{:lang('SENDER_EMAIL_ADDRESS')}
                </label>
                <div class="col-md-8 col-sm-10">
                    <input type="text" class="form-control" id="input-from" name="from" value="{$from|default=''}">
                </div>
            </div>
            <div class="row mb-3">
                <label for="input-host" class="col-sm-2 col-form-label text-sm-end">
                    <span class="form-required">*</span>{:lang('SENDER_SMTP_SERVER')}
                </label>
                <div class="col-md-8 col-sm-10">
                    <input type="text" class="form-control" id="input-host" name="host" value="{$host|default=''}">
                </div>
            </div>
            <div class="row mb-3">
                <label for="js-smtpsecure" class="col-sm-2 col-form-label text-sm-end">
                    <span class="form-required">*</span>{:lang('SMTP Secure Protocol')}
                </label>
                <div class="col-md-8 col-sm-10">
                    <select name="smtp_secure" id="js-smtpsecure" class="form-control">
                        <option value="">{:lang('Default')}</option>
                        <option value="ssl">ssl</option>
                        <option value="tls">tls</option>
                    </select>
                </div>
            </div>
            <div class="row mb-3">
                <label for="input-port" class="col-sm-2 col-form-label text-sm-end">
                    <span class="form-required">*</span>{:lang('SMTP Server Port')}
                </label>
                <div class="col-md-8 col-sm-10">
                    <input type="text" class="form-control" id="input-port" name="port" value="{$port|default=''}"
                           placeholder="25">
                </div>
            </div>
            <div class="row mb-3">
                <label for="input-login_name" class="col-sm-2 col-form-label text-sm-end">
                    <span class="form-required">*</span>{:lang('SMTP_MAIL_ADDRESS')}
                </label>
                <div class="col-md-8 col-sm-10">
                    <input type="text" class="form-control" id="input-login_name" name="username"
                           value="{$username|default=''}">
                </div>
            </div>
            <div class="row mb-3">
                <label for="input-password" class="col-sm-2 col-form-label text-sm-end">
                    <span class="form-required">*</span>{:lang('SMTP_MAIL_PASSWORD')}
                </label>
                <div class="col-md-8 col-sm-10">
                    <input type="password" class="form-control" id="input-password" name="password"
                           value="{$password|default=''}">
                </div>
            </div>
            <div class="row mb-3">
                <label for="signature" class="col-sm-2 col-form-label text-sm-end"><span
                        class="form-required">*</span>{:lang('Email Signature')}</label>
                <div class="col-md-8 col-sm-12">
                    <script type="text/plain" id="signature"
                            name="signature">{$signature|default=""|htmlspecialchars_decode}</script>
                    <literal><span style="color: #ffb752;"><!--，{$username}代替用户名--></span></literal>
                </div>
            </div>
            <div class="row mb-3">
                <div class="offset-md-2 col-sm-10">
                    <button type="submit" class="btn btn-primary js-ajax-submit">
                        <i class="fa fa-save fa-fw"></i> {:lang('SAVE')}
                    </button>
                    <a class="btn btn-warning"
                       href="javascript:parent.openIframeLayer('{:url('User/emailSettingTest')}','{:lang('Send Test Email')}',{area:['600px','400px']});">
                        {:lang('Send Test Email')}
                    </a>
                </div>
            </div>
        </form>
    </div>
</block>
<block name="scripts">
    <script type="text/javascript">
        //编辑器路径定义
        var editorURL = GV.WEB_ROOT;
    </script>
    <script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
    <script type="text/javascript">
        var editorcontent = new baidu.editor.ui.Editor();
        editorcontent.render('signature');
    </script>
    <script>
        $(function () {
            $('#js-smtpsecure').val("{$smtp_secure|default=''}");
        });
    </script>
</block>
